home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / emacs-complete / fsf / emacs / info / emacs-11 < prev    next >
Encoding:
GNU Info File  |  1994-10-06  |  47.9 KB  |  1,242 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Overview of Emerge,  Next: Submodes of Emerge,  Up: Emerge
  6.  
  7. Overview of Emerge
  8. ------------------
  9.  
  10.    To start Emerge, run one of these four commands:
  11.  
  12. `M-x emerge-files'
  13.      Merge two specified files.
  14.  
  15. `M-x emerge-files-with-ancestor'
  16.      Merge two specified files, with reference to a common ancestor.
  17.  
  18. `M-x emerge-buffers'
  19.      Merge two buffers.
  20.  
  21. `M-x emerge-buffers-with-ancestor'
  22.      Merge two buffers with reference to a common ancestor in a third
  23.      buffer.
  24.  
  25.    The Emerge commands compare two files or buffers, and display the
  26. comparison in three buffers: one for each input text (the "A buffer"
  27. and the "B buffer"), and one (the "merge buffer") where merging takes
  28. place.  The merge buffer shows the full merged text, not just the
  29. differences.  Wherever the two input texts differ, you can choose which
  30. one of them to include in the merge buffer.
  31.  
  32.    The Emerge commands that take input from existing buffers use only
  33. the accessible portions of those buffers, if they are narrowed (*note
  34. Narrowing::.).
  35.  
  36.    If a common ancestor version is available, from which the two texts
  37. to be merged were both derived, Emerge can use it to guess which
  38. alternative is right.  Wherever one current version agrees with the
  39. ancestor, Emerge presumes that the other current version is a deliberate
  40. change which should be kept in the merged version.  Use the
  41. `with-ancestor' commands if you want to specify a common ancestor text.
  42. These commands read three file or buffer names--variant A, variant B,
  43. and the common ancestor.
  44.  
  45.    After the comparison is done and the buffers are prepared, the
  46. interactive merging starts.  You control the merging by typing special
  47. "merge commands" in the merge buffer.  The merge buffer shows you a
  48. full merged text, not just differences.  For each run of differences
  49. between the input texts, you can choose which one of them to keep, or
  50. edit them both together.
  51.  
  52.    The merge buffer uses a special major mode, Emerge mode, with
  53. commands for making these choices.  But you can also edit the buffer
  54. with ordinary Emacs commands.
  55.  
  56.    At any given time, the attention of Emerge is focused on one
  57. particular difference, called the "selected" difference.  This
  58. difference is marked off in the three buffers like this:
  59.  
  60.      vvvvvvvvvvvvvvvvvvvv
  61.      TEXT THAT DIFFERS
  62.      ^^^^^^^^^^^^^^^^^^^^
  63.  
  64. Emerge numbers all the differences sequentially and the mode line
  65. always shows the number of the selected difference.
  66.  
  67.    Normally, the merge buffer starts out with the A version of the text.
  68. But when the A version of a difference agrees with the common ancestor,
  69. then the B version is initially preferred for that difference.
  70.  
  71.    Emerge leaves the merged text in the merge buffer when you exit.  At
  72. that point, you can save it in a file with `C-x C-w'.  If you give a
  73. numeric argument to `emerge-files' or `emerge-files-with-ancestor', it
  74. reads the name of the output file using the minibuffer.  (This is the
  75. last file name those commands read.) Then exiting from Emerge saves the
  76. merged text in the output file.
  77.  
  78.    Normally, Emerge commands save the output buffer in its file when you
  79. exit.  If you abort Emerge with `C-]', the Emerge command does not save
  80. the output buffer, but you can save it yourself if you wish.
  81.  
  82. 
  83. File: emacs,  Node: Submodes of Emerge,  Next: State of Difference,  Prev: Overview of Emerge,  Up: Emerge
  84.  
  85. Submodes of Emerge
  86. ------------------
  87.  
  88.    You can choose between two modes for giving merge commands: Fast mode
  89. and Edit mode.  In Fast mode, basic merge commands are single
  90. characters, but ordinary Emacs commands are disabled.  This is
  91. convenient if you use only merge commands.  In Edit mode, all merge
  92. commands start with the prefix key `C-c C-c', and the normal Emacs
  93. commands are also available.  This allows editing the merge buffer, but
  94. slows down Emerge operations.
  95.  
  96.    Use `e' to switch to Edit mode, and `C-c C-c f' to switch to Fast
  97. mode.  The mode line indicates Edit and Fast modes with `E' and `F'.
  98.  
  99.    Emerge has two additional submodes that affect how particular merge
  100. commands work: Auto Advance mode and Skip Prefers mode.
  101.  
  102.    If Auto Advance mode is in effect, the `a' and `b' commands advance
  103. to the next difference.  This lets you go through the merge faster as
  104. long as you simply choose one of the alternatives from the input.  The
  105. mode line indicates Auto Advance mode with `A'.
  106.  
  107.    If Skip Prefers mode is in effect, the `n' and `p' commands skip
  108. over differences in states prefer-A and prefer-B (*note State of
  109. Difference::.).  Thus you see only differences for which neither version
  110. is presumed "correct".  The mode line indicates Skip Prefers mode with
  111. `S'.
  112.  
  113.    Use the command `s a' (`emerge-auto-advance-mode') to set or clear
  114. Auto Advance mode.  Use `s s' (`emerge-skip-prefers-mode') to set or
  115. clear Skip Prefers mode.  These commands turn on the mode with a
  116. positive argument, turns it off with a negative or zero argument, and
  117. toggle the mode with no argument.
  118.  
  119. 
  120. File: emacs,  Node: State of Difference,  Next: Merge Commands,  Prev: Submodes of Emerge,  Up: Emerge
  121.  
  122. State of a Difference
  123. ---------------------
  124.  
  125.    In the merge buffer, a difference is marked with lines of `v' and
  126. `^' characters.  Each difference has one of these seven states:
  127.  
  128. A
  129.      The difference is showing the A version.  The `a' command always
  130.      produces this state; the mode line indicates it with `A'.
  131.  
  132. B
  133.      The difference is showing the B version.  The `b' command always
  134.      produces this state; the mode line indicates it with `B'.
  135.  
  136. default-A
  137. default-B
  138.      The difference is showing the A or the B state by default, because
  139.      you haven't made a choice.  All differences start in the default-A
  140.      state (and thus the merge buffer is a copy of the A buffer),
  141.      except those for which one alternative is "preferred" (see below).
  142.  
  143.      When you select a difference, its state changes from default-A or
  144.      default-B to plain A or B.  Thus, the selected difference never has
  145.      state default-A or default-B, and these states are never displayed
  146.      in the mode line.
  147.  
  148.      The command `d a' chooses default-A as the default state, and `d
  149.      b' chooses default-B.  This chosen default applies to all
  150.      differences which you haven't ever selected and for which no
  151.      alternative is preferred.  If you are moving through the merge
  152.      sequentially, the differences you haven't selected are those
  153.      following the selected one.  Thus, while moving sequentially, you
  154.      can effectively make the A version the default for some sections
  155.      of the merge buffer and the B version the default for others by
  156.      using `d a' and `d b' between sections.
  157.  
  158. prefer-A
  159. prefer-B
  160.      The difference is showing the A or B state because it is
  161.      "preferred".  This means that you haven't made an explicit choice,
  162.      but one alternative seems likely to be right because the other
  163.      alternative agrees with the common ancestor.  Thus, where the A
  164.      buffer agrees with the common ancestor, the B version is
  165.      preferred, because chances are it is the one that was actually
  166.      changed.
  167.  
  168.      These two states are displayed in the mode line as `A*' and `B*'.
  169.  
  170. combined
  171.      The difference is showing a combination of the A and B states, as a
  172.      result of the `x c' or `x C' commands.
  173.  
  174.      Once a difference is in this state, the `a' and `b' commands don't
  175.      do anything to it unless you give them a numeric argument.
  176.  
  177.      The mode line displays this state as `comb'.
  178.  
  179. 
  180. File: emacs,  Node: Merge Commands,  Next: Exiting Emerge,  Prev: State of Difference,  Up: Emerge
  181.  
  182. Merge Commands
  183. --------------
  184.  
  185.    Here are the Merge commands for Fast mode; in Edit mode, precede them
  186. with `C-c C-c':
  187.  
  188. `p'
  189.      Select the previous difference.
  190.  
  191. `n'
  192.      Select the next difference.
  193.  
  194. `a'
  195.      Choose the A version of this difference.
  196.  
  197. `b'
  198.      Choose the B version of this difference.
  199.  
  200. `C-u N j'
  201.      Select difference number N.
  202.  
  203. `.'
  204.      Select the difference containing point.  You can use this command
  205.      in the merge buffer or in the A or B buffer.
  206.  
  207. `q'
  208.      Quit--finish the merge.
  209.  
  210. `C-]'
  211.      Abort--exit merging and do not save the output.
  212.  
  213. `f'
  214.      Go into Fast mode.  (In Edit mode, this is actually `C-c C-c f'.)
  215.  
  216. `e'
  217.      Go into Edit mode.
  218.  
  219. `l'
  220.      Recenter (like `C-l') all three windows.
  221.  
  222. `-'
  223.      Specify part of a prefix numeric argument.
  224.  
  225. `DIGIT'
  226.      Also specify part of a prefix numeric argument.
  227.  
  228. `d a'
  229.      Choose the A version as the default from here down in the merge
  230.      buffer.
  231.  
  232. `d b'
  233.      Choose the B version as the default from here down in the merge
  234.      buffer.
  235.  
  236. `c a'
  237.      Copy the A version of this difference into the kill ring.
  238.  
  239. `c b'
  240.      Copy the B version of this difference into the kill ring.
  241.  
  242. `i a'
  243.      Insert the A version of this difference at point.
  244.  
  245. `i b'
  246.      Insert the B version of this difference at point.
  247.  
  248. `m'
  249.      Put point and mark around the difference.
  250.  
  251. `^'
  252.      Scroll all three windows down (like `M-v').
  253.  
  254. `v'
  255.      Scroll all three windows up (like `C-v').
  256.  
  257. `<'
  258.      Scroll all three windows left (like `C-x <').
  259.  
  260. `>'
  261.      Scroll all three windows right (like `C-x >').
  262.  
  263. `|'
  264.      Reset horizontal scroll on all three windows.
  265.  
  266. `x 1'
  267.      Shrink the merge window to one line.  (Use `C-u l' to restore it
  268.      to full size.)
  269.  
  270. `x c'
  271.      Combine the two versions of this difference (*note Combining in
  272.      Emerge::.).
  273.  
  274. `x f'
  275.      Show the names of the files/buffers Emerge is operating on, in a
  276.      Help window.  (Use `C-u l' to restore windows.)
  277.  
  278. `x j'
  279.      Join this difference with the following one.  (`C-u x j' joins
  280.      this difference with the previous one.)
  281.  
  282. `x s'
  283.      Split this difference into two differences.  Before you use this
  284.      command, position point in each of the three buffers at the place
  285.      where you want to split the difference.
  286.  
  287. `x t'
  288.      Trim identical lines off top and bottom of the difference.  Such
  289.      lines occur when the A and B versions are identical but differ
  290.      from the ancestor version.
  291.  
  292. 
  293. File: emacs,  Node: Exiting Emerge,  Next: Combining in Emerge,  Prev: Merge Commands,  Up: Emerge
  294.  
  295. Exiting Emerge
  296. --------------
  297.  
  298.    The `q' command (`emerge-quit') finishes the merge, storing the
  299. results into the output file if you specified one.  It restores the A
  300. and B buffers to their proper contents, or kills them if they were
  301. created by Emerge and you haven't changed them.  It also disables the
  302. Emerge commands in the merge buffer, since executing them later could
  303. damage the contents of the various buffers.
  304.  
  305.    `C-]' aborts the merge.  This means exiting without writing the
  306. output file.  If you didn't specify an output file, then there is no
  307. real difference between aborting and finishing the merge.
  308.  
  309.    If the Emerge command was called from another Lisp program, then its
  310. return value is `t' for successful completion, or `nil' if you abort.
  311.  
  312. 
  313. File: emacs,  Node: Combining in Emerge,  Next: Fine Points of Emerge,  Prev: Exiting Emerge,  Up: Emerge
  314.  
  315. Combining the Two Versions
  316. --------------------------
  317.  
  318.    Sometimes you want to keep *both* alternatives for a particular
  319. difference.  To do this, use `x c', which edits the merge buffer like
  320. this:
  321.  
  322.      #ifdef NEW
  323.      VERSION FROM A BUFFER
  324.      #else /* NEW */
  325.      VERSION FROM B BUFFER
  326.      #endif /* NEW */
  327.  
  328. While this example shows C preprocessor conditionals delimiting the two
  329. alternative versions, you can specify the strings to use by setting the
  330. variable `emerge-combine-versions-template' to a string of your choice.
  331. In the string, `%a' says where to put version A, and `%b' says where
  332. to put version B.  The default setting, which produces the results
  333. shown above, looks like this:
  334.  
  335.      "#ifdef NEW\n%a#else /* NEW */\n%b#endif /* NEW */\n"
  336.  
  337. 
  338. File: emacs,  Node: Fine Points of Emerge,  Prev: Combining in Emerge,  Up: Emerge
  339.  
  340. Fine Points of Emerge
  341. ---------------------
  342.  
  343.    During the merge, you mustn't try to edit the A and B buffers
  344. yourself.  Emerge modifies them temporarily, but ultimately puts them
  345. back the way they were.
  346.  
  347.    You can have any number of merges going at once--just don't use any
  348. one buffer as input to more than one merge at once, since the temporary
  349. changes made in these buffers would get in each other's way.
  350.  
  351.    Starting Emerge can take a long time because it needs to compare the
  352. files fully.  Emacs can't do anything else until `diff' finishes.
  353. Perhaps in the future someone will change Emerge to do the comparison in
  354. the background when the input files are large--then you could keep on
  355. doing other things with Emacs until Emerge gets ready to accept
  356. commands.
  357.  
  358.    After setting up the merge, Emerge runs the hook
  359. `emerge-startup-hook' (*note Hooks::.).
  360.  
  361. 
  362. File: emacs,  Node: C Mode,  Next: Fortran,  Prev: Emerge,  Up: Programs
  363.  
  364. C Mode
  365. ======
  366.  
  367.    In addition to the facilities of typical programming language major
  368. modes (*note Program Modes::.), C mode has various special facilities.
  369.  
  370. `M-a'
  371. `M-e'
  372.      In C mode, `M-a' and `M-e' move by complete C statements
  373.      (`c-beginning-of-statement' and `c-end-of-statement').  These
  374.      commands do ordinary, textual sentence motion when in or next to a
  375.      comment.
  376.  
  377. `M-q'
  378.      `M-q' in C mode runs `c-fill-paragraph', which is designed for
  379.      filling C comments.  (We assume you don't want to fill the actual
  380.      C code in a C program.)
  381.  
  382. `C-c C-u'
  383.      Move back to the containing preprocessor conditional, setting the
  384.      mark at the starting point (`c-up-conditional').
  385.  
  386.      A numeric argument acts as a repeat count.  With a negative
  387.      argument, this command moves forward to the end of the containing
  388.      preprocessor conditional.  When going backwards, `#elif' acts like
  389.      `#else' followed by `#if'.  When going forwards, `#elif' is
  390.      ignored.
  391.  
  392. `C-c C-n'
  393.      Move forward across the next preprocessor conditional, setting the
  394.      mark at the starting point (`c-forward-conditional').
  395.  
  396. `C-c C-p'
  397.      Move backward across the previous preprocessor conditional,
  398.      setting the at the starting point (`c-backward-conditional').
  399.  
  400. `M-x c-macro-expand'
  401.      When you are debugging C code that uses macros, sometimes it is
  402.      hard to figure out precisely how the macros expand.  The command
  403.      `M-x c-macro-expand' runs the C preprocessor and shows you what
  404.      expansion results from the region.  The portion of the buffer
  405.      before the region is also included in preprocessing, for the sake
  406.      of macros defined there, but the output from this part isn't shown.
  407.  
  408. `M-x c-backslash-region'
  409.      Insert or align `\' characters at the ends of the lines of the
  410.      region, except for the last such line.  This is useful after
  411.      writing or editing a C macro definition.
  412.  
  413.      If a line already ends in `\', this command adjusts the amount of
  414.      whitespace before it.  Otherwise, it inserts a new `\'.
  415.  
  416.    C++ mode is like C mode, except that it understands C++ comment
  417. syntax and certain other differences between C and C++.  It also has a
  418. command `M-x fill-c++-comment', which fills a paragraph made of C++
  419. comment lines.
  420.  
  421.    The command `comment-region' is useful in C++ mode for commenting
  422. out several consecutive lines, or removing the commenting out of such
  423. lines.  (You don't need this command with C comment syntax because you
  424. don't need to put comment delimiters on each line.)  *Note Comments::.
  425.  
  426. 
  427. File: emacs,  Node: Fortran,  Next: Asm Mode,  Prev: C Mode,  Up: Programs
  428.  
  429. Fortran Mode
  430. ============
  431.  
  432.    Fortran mode provides special motion commands for Fortran statements
  433. and subprograms, and indentation commands that understand Fortran
  434. conventions of nesting, line numbers and continuation statements.
  435. Fortran mode has it's own Auto Fill mode that breaks long lines into
  436. proper Fortran continuation lines.
  437.  
  438.    Special commands for comments are provided because Fortran comments
  439. are unlike those of other languages.  Built-in abbrevs optionally save
  440. typing when you insert Fortran keywords.
  441.  
  442.    Use `M-x fortran-mode' to switch to this major mode.  This command
  443. runs the hook `fortran-mode-hook' (*note Hooks::.).
  444.  
  445. * Menu:
  446.  
  447. * Motion: Fortran Motion.     Moving point by statements or subprograms.
  448. * Indent: Fortran Indent.     Indentation commands for Fortran.
  449. * Comments: Fortran Comments.     Inserting and aligning comments.
  450. * Autofill: Fortran Autofill.     Auto fill minor mode for Fortran.
  451. * Columns: Fortran Columns.     Measuring columns for valid Fortran.
  452. * Abbrev: Fortran Abbrev.     Built-in abbrevs for Fortran keywords.
  453.  
  454.    Fortran mode was contributed by Michael Prange.  It has been updated
  455. by Stephen A. Wood who has collated the contributions and suggestions
  456. of many users.
  457.  
  458. 
  459. File: emacs,  Node: Fortran Motion,  Next: Fortran Indent,  Up: Fortran
  460.  
  461. Motion Commands
  462. ---------------
  463.  
  464.    Fortran mode provides special commands to move by subprograms
  465. (functions and subroutines) and by statements.  There is also a command
  466. to put the region around one subprogram, convenient for killing it or
  467. moving it.
  468.  
  469. `C-M-a'
  470.      Move to beginning of subprogram
  471.      (`beginning-of-fortran-subprogram').
  472.  
  473. `C-M-e'
  474.      Move to end of subprogram (`end-of-fortran-subprogram').
  475.  
  476. `C-M-h'
  477.      Put point at beginning of subprogram and mark at end
  478.      (`mark-fortran-subprogram').
  479.  
  480. `C-c C-n'
  481.      Move to beginning of current or next statement
  482.      (`fortran-next-statement').
  483.  
  484. `C-c C-p'
  485.      Move to beginning of current or previous statement
  486.      (`fortran-previous-statement').
  487.  
  488. 
  489. File: emacs,  Node: Fortran Indent,  Next: Fortran Comments,  Prev: Fortran Motion,  Up: Fortran
  490.  
  491. Fortran Indentation
  492. -------------------
  493.  
  494.    Special commands and features are needed for indenting Fortran code
  495. in order to make sure various syntactic entities (line numbers, comment
  496. line indicators and continuation line flags) appear in the columns that
  497. are required for standard Fortran.
  498.  
  499. * Menu:
  500.  
  501. * Commands: ForIndent Commands.  Commands for indenting Fortran.
  502. * Contline: ForIndent Cont.      How continuation lines indent.
  503. * Numbers:  ForIndent Num.       How line numbers auto-indent.
  504. * Conv:     ForIndent Conv.      Conventions you must obey to avoid trouble.
  505. * Vars:     ForIndent Vars.      Variables controlling Fortran indent style.
  506.  
  507. 
  508. File: emacs,  Node: ForIndent Commands,  Next: ForIndent Cont,  Up: Fortran Indent
  509.  
  510. Fortran Indentation Commands
  511. ............................
  512.  
  513. `TAB'
  514.      Indent the current line (`fortran-indent-line').
  515.  
  516. `LFD'
  517.      Indent the current and start a new indented line
  518.      (`fortran-indent-new-line').
  519.  
  520. `M-LFD'
  521.      Break the current line and set up a continuation line.
  522.  
  523. `C-M-q'
  524.      Indent all the lines of the subprogram point is in
  525.      (`fortran-indent-subprogram').
  526.  
  527.    Fortran mode redefines TAB to reindent the current line for Fortran
  528. (`fortran-indent-line').  This command indents Line numbers and
  529. continuation markers to their required columns, and independently
  530. indents the body of the statement based on its nesting in the program.
  531.  
  532.    The key `LFD' runs the command `fortran-indent-new-line', which
  533. reindents the current line then makes and indents a new line.  This
  534. command is useful to reindent the closing statement of `do' loops and
  535. other blocks before starting a new line.
  536.  
  537.    The key `C-M-q' runs `fortran-indent-subprogram', a command to
  538. reindent all the lines of the Fortran subprogram (function or
  539. subroutine) containing point.
  540.  
  541.    The key `M-LFD' runs `fortran-split-line', which splits a line in
  542. the appropriate fashion for Fortran.  In a non-comment line, the second
  543. half becomes a continuation line and is indented accordingly.  In a
  544. comment line, both halves become separate comment lines.
  545.  
  546. 
  547. File: emacs,  Node: ForIndent Cont,  Next: ForIndent Num,  Prev: ForIndent Commands,  Up: Fortran Indent
  548.  
  549. Continuation Lines
  550. ..................
  551.  
  552.    Most modern Fortran compilers allow two ways of writing continuation
  553. lines.  If the first non-space character on a line is in column 5, then
  554. that line is a continuation of the previous line.  We call this "fixed
  555. format".  (In GNU Emacs we always count columns from 0.)  The variable
  556. `fortran-continuation-string' specifies what character to put on column
  557. 5.  A line that starts with a tab character followed by any digit
  558. except `0' is also a continuation line.  We call this style of
  559. continuation "tab format".
  560.  
  561.    Fortran mode can make either style of continuation line, but you
  562. must specify which one you prefer.  The value of the variable
  563. `indent-tabs-mode' controls the choice: `nil' for fixed format, and
  564. non-`nil' for tab format.  You can tell which style is presently in
  565. effect by the presence or absence of the string `Tab' in the mode line.
  566.  
  567.    If the text on a line starts with the conventional Fortran
  568. continuation marker `$', or if it begins with any non-whitespace
  569. character in column 5, Fortran mode treats it as a continuation line.
  570. When you indent a continuation line with TAB, it converts the line to
  571. the current continuation style.  When you split a Fortran statement
  572. with `M-LFD', the continuation marker on the newline is created
  573. according to the continuation style.
  574.  
  575.    The setting of continuation style affects several other aspects of
  576. editing in Fortran mode.  In fixed format mode, the minimum column
  577. number for the body of a statement is 6.  Lines inside of Fortran
  578. blocks that are indented to larger column numbers always use only the
  579. space character for whitespace.  In tab format mode, the minimum column
  580. number for the statement body is 8, and the whitespace before column 8
  581. must always consist of one tab character.
  582.  
  583.    When you enter Fortran mode for an existing file, it tries to deduce
  584. the proper continuation style automatically from the file contents.
  585. The first line that begins with either a tab character or six spaces
  586. determines the choice.  The variable `fortran-analyze-depth' specifies
  587. how many lines to consider (at the beginning of the file); if none of
  588. those lines indicates a style, then the variable
  589. `fortran-tab-mode-default' specifies the style.  If it is `nil', that
  590. specifies fixed format, and non-`nil' specifies tab format.
  591.  
  592. 
  593. File: emacs,  Node: ForIndent Num,  Next: ForIndent Conv,  Prev: ForIndent Cont,  Up: Fortran Indent
  594.  
  595. Line Numbers
  596. ............
  597.  
  598.    If a number is the first non-whitespace in the line, Fortran
  599. indentation assumes it is a line number and moves it to columns 0
  600. through 4.  (Columns always count from 0 in GNU Emacs.)
  601.  
  602.    Line numbers of four digits or less are normally indented one space.
  603. The variable `fortran-line-number-indent' controls this; it specifies
  604. the maximum indentation a line number can have.  Line numbers are
  605. indented to right-justify them to end in column 4 unless that would
  606. require more than this maximum indentation.  The default value of the
  607. variable is 1.
  608.  
  609.    Simply inserting a line number is enough to indent it according to
  610. these rules.  As each digit is inserted, the indentation is recomputed.
  611. To turn off this feature, set the variable
  612. `fortran-electric-line-number' to `nil'.  Then inserting line numbers
  613. is like inserting anything else.
  614.  
  615. 
  616. File: emacs,  Node: ForIndent Conv,  Next: ForIndent Vars,  Prev: ForIndent Num,  Up: Fortran Indent
  617.  
  618. Syntactic Conventions
  619. .....................
  620.  
  621.    Fortran mode assumes that you follow certain conventions that
  622. simplify the task of understanding a Fortran program well enough to
  623. indent it properly:
  624.  
  625.    * Two nested `do' loops never share a `continue' statement.
  626.  
  627.    * Fortran keywords such as `if', `else', `then', `do' and others are
  628.      written without embedded whitespace or line breaks.
  629.  
  630.      Fortran compilers generally ignore whitespace outside of string
  631.      constants, but Fortran mode does not recognize these keywords if
  632.      they are not contiguous.  Constructs such as `else if' or `end do'
  633.      are acceptable, but the second word should be on the same line as
  634.      the first and not on a continuation line.
  635.  
  636. If you fail to follow these conventions, the indentation commands may
  637. indent some lines unaesthetically.  However, a correct Fortran program
  638. retains its meaning when reindented even if the conventions are not
  639. followed.
  640.  
  641. 
  642. File: emacs,  Node: ForIndent Vars,  Prev: ForIndent Conv,  Up: Fortran Indent
  643.  
  644. Variables for Fortran Indentation
  645. .................................
  646.  
  647.    Several additional variables control how Fortran indentation works:
  648.  
  649. `fortran-do-indent'
  650.      Extra indentation within each level of `do' statement (default 3).
  651.  
  652. `fortran-if-indent'
  653.      Extra indentation within each level of `if' statement (default 3).
  654.      This value is also used for extra indentation within each level of
  655.      the Fortran 90 `where' statement.
  656.  
  657. `fortran-structure-indent'
  658.      Extra indentation within each level of `structure', `union', or
  659.      `map' statements (default 3).
  660.  
  661. `fortran-continuation-indent'
  662.      Extra indentation for bodies of continuation lines (default 5).
  663.  
  664. `fortran-check-all-num-for-matching-do'
  665.      If this is `nil', indentation assumes that each `do' statement
  666.      ends on a `continue' statement.  Therefore, when computing
  667.      indentation for a statement other than `continue', it can save time
  668.      by not checking for a `do' statement ending there.  If this is
  669.      non-`nil', indenting any numbered statement must check for a `do'
  670.      that ends there.  The default is `nil'.
  671.  
  672. `fortran-blink-matching-if'
  673.      If this is `t', indenting an `endif' statement moves the cursor
  674.      momentarily to the matching `if' statement to show where it is.
  675.      The default is `nil'.
  676.  
  677. `fortran-minimum-statement-indent-fixed'
  678.      Minimum indentation for fortran statements when using fixed format
  679.      continuation line style.  Statement bodies are never indented less
  680.      than this much.  The default is 6.
  681.  
  682. `fortran-minimum-statement-indent-tab'
  683.      Minimum indentation for fortran statements for tab format
  684.      continuation line style.  Statement bodies are never indented less
  685.      than this much.  The default is 8.
  686.  
  687. 
  688. File: emacs,  Node: Fortran Comments,  Next: Fortran Autofill,  Prev: Fortran Indent,  Up: Fortran
  689.  
  690. Fortran Comments
  691. ----------------
  692.  
  693.    The usual Emacs comment commands assume that a comment can follow a
  694. line of code.  In Fortran, the standard comment syntax requires an
  695. entire line to be just a comment.  Therefore, Fortran mode replaces the
  696. standard Emacs comment commands and defines some new variables.
  697.  
  698.    Fortran mode can also handle a nonstandard comment syntax where
  699. comments start with `!' and can follow other text.  Because only some
  700. Fortran compilers accept this syntax, Fortran mode will not insert such
  701. comments unless you have said in advance to do so.  To do this, set the
  702. variable `comment-start' to `"!"' (*note Variables::.).
  703.  
  704. `M-;'
  705.      Align comment or insert new comment (`fortran-comment-indent').
  706.  
  707. `C-x ;'
  708.      Applies to nonstandard `!' comments only.
  709.  
  710. `C-c ;'
  711.      Turn all lines of the region into comments, or (with argument)
  712.      turn them back into real code (`fortran-comment-region').
  713.  
  714.    `M-;' in Fortran mode is redefined as the command
  715. `fortran-comment-indent'.  Like the usual `M-;' command, this
  716. recognizes any kind of existing comment and aligns its text
  717. appropriately; if there is no existing comment, a comment is inserted
  718. and aligned.  But inserting and aligning comments are not the same in
  719. Fortran mode as in other modes.
  720.  
  721.    When a new comment must be inserted, if the current line is blank, a
  722. full-line comment is inserted.  On a non-blank line, a nonstandard `!'
  723. comment is inserted if you have said you want to use them.  Otherwise a
  724. full-line comment is inserted on a new line before the current line.
  725.  
  726.    Nonstandard `!' comments are aligned like comments in other
  727. languages, but full-line comments are different.  In a standard
  728. full-line comment, the comment delimiter itself must always appear in
  729. column zero.  What can be aligned is the text within the comment.  You
  730. can choose from three styles of alignment by setting the variable
  731. `fortran-comment-indent-style' to one of these values:
  732.  
  733. `fixed'
  734.      Align the text at a fixed column, which is the sum of
  735.      `fortran-comment-line-extra-indent' and the minimum statement
  736.      indentation.  This is the default.
  737.  
  738.      The minimum statement indentation is
  739.      `fortran-minimum-statement-indent-fixed' for fixed format
  740.      continuation line style and `fortran-minimum-statement-indent-tab'
  741.      for tab format style.
  742.  
  743. `relative'
  744.      Align the text as if it were a line of code, but with an additional
  745.      `fortran-comment-line-extra-indent' columns of indentation.
  746.  
  747. `nil'
  748.      Don't move text in full-line columns automatically at all.
  749.  
  750.    In addition, you can specify the character to be used to indent
  751. within full-line comments by setting the variable
  752. `fortran-comment-indent-char' to the single-character string you want
  753. to use.
  754.  
  755.    Fortran mode introduces two variables `comment-line-start' and
  756. `comment-line-start-skip' which play for full-line comments the same
  757. roles played by `comment-start' and `comment-start-skip' for ordinary
  758. text-following comments.  Normally these are set properly by Fortran
  759. mode so you do not need to change them.
  760.  
  761.    The normal Emacs comment command `C-x ;' has not been redefined.  If
  762. you use `!' comments, this command can be used with them.  Otherwise it
  763. is useless in Fortran mode.
  764.  
  765.    The command `C-c ;' (`fortran-comment-region') turns all the lines
  766. of the region into comments by inserting the string `C$$$' at the front
  767. of each one.  With a numeric argument, it turns the region back into
  768. live code by deleting `C$$$' from the front of each line in it.  The
  769. string used for these comments can be controlled by setting the
  770. variable `fortran-comment-region'.  Note that here we have an example
  771. of a command and a variable with the same name; these two uses of the
  772. name never conflict because in Lisp and in Emacs it is always clear
  773. from the context which one is meant.
  774.  
  775. 
  776. File: emacs,  Node: Fortran Autofill,  Next: Fortran Columns,  Prev: Fortran Comments,  Up: Fortran
  777.  
  778. Fortran Auto Fill Mode
  779. ----------------------
  780.  
  781.    Fortran Auto Fill mode is a minor mode which automatically splits
  782. Fortran statements as you insert them when they become too wide.
  783. Splitting a statement involves making continuation lines using
  784. `fortran-continuation-string' (*Note ForIndent Cont::).  This splitting
  785. happens when you type SPC, RET, or TAB, and also in the Fortran
  786. indentation commands.
  787.  
  788.    `M-x fortran-auto-fill-mode' turns Fortran Auto Fill mode on if it
  789. was off, or off if it was on.  This command works the same as `M-x
  790. auto-fill-mode' does for normal Auto Fill mode (*note Filling::.).  A
  791. positive numeric argument turns Fortran Auto Fill mode on, and a
  792. negative argument turns it off.  You can see when Fortran Auto Fill mode
  793. is in effect by the presence of the word `Fill' in the mode line,
  794. inside the parentheses.  Fortran Auto Fill mode is a minor mode, turned
  795. on or off for each buffer individually.  *Note Minor Modes::.
  796.  
  797.    Fortran Auto Fill mode breaks lines at spaces or delimiters when the
  798. lines get longer than the desired width (the value of `fill-column').
  799. The delimiters that Fortran Auto Fill mode may break at are `,', `'',
  800. `+', `-', `/', `*', `=', and `)'.  The line break comes after the
  801. delimiter if the variable `fortran-break-before-delimiters' is `nil'.
  802. Otherwise (and by default), the break comes before the delimiter.
  803.  
  804.    By default, Fortran Auto Fill mode is not enabled.  If you want this
  805. feature turned on permanently, add a hook function to
  806. `fortran-mode-hook' to execute `(fortran-auto-fill-mode 1)'.  *Note
  807. Hooks::.
  808.  
  809. 
  810. File: emacs,  Node: Fortran Columns,  Next: Fortran Abbrev,  Prev: Fortran Autofill,  Up: Fortran
  811.  
  812. Checking Columns in Fortran
  813. ---------------------------
  814.  
  815. `C-c C-r'
  816.      Display a "column ruler" momentarily above the current line
  817.      (`fortran-column-ruler').
  818.  
  819. `C-c C-w'
  820.      Split the current window horizontally temporarily so that it is 72
  821.      columns wide.  This may help you avoid making lines longer than
  822.      the 72 character limit that some fortran compilers impose
  823.      (`fortran-window-create-momentarily').
  824.  
  825.    The command `C-c C-r' (`fortran-column-ruler') shows a column ruler
  826. momentarily above the current line.  The comment ruler is two lines of
  827. text that show you the locations of columns with special significance in
  828. Fortran programs.  Square brackets show the limits of the columns for
  829. line numbers, and curly brackets show the limits of the columns for the
  830. statement body.  Column numbers appear above them.
  831.  
  832.    Note that the column numbers count from zero, as always in GNU Emacs.
  833. As a result, the numbers may be one less than those you are familiar
  834. with; but the positions they indicate in the line are standard for
  835. Fortran.
  836.  
  837.    The text used to display the column ruler depends on the value of
  838. the variable `indent-tabs-mode'.  If `indent-tabs-mode' is `nil', then
  839. the value of the variable `fortran-column-ruler-fixed' is used as the
  840. column ruler.  Otherwise, the variable `fortran-column-ruler-tab' is
  841. displayed.  By changing these variables, you can change the column
  842. ruler display.
  843.  
  844.    For even more help, use `C-c C-w' (`fortran-window-create'), a
  845. command which splits the current window horizontally, making a window 72
  846. columns wide.  By editing in this window you can immediately see when
  847. you make a line too wide to be correct Fortran.
  848.  
  849. 
  850. File: emacs,  Node: Fortran Abbrev,  Prev: Fortran Columns,  Up: Fortran
  851.  
  852. Fortran Keyword Abbrevs
  853. -----------------------
  854.  
  855.    Fortran mode provides many built-in abbrevs for common keywords and
  856. declarations.  These are the same sort of abbrev that you can define
  857. yourself.  To use them, you must turn on Abbrev mode.  *Note Abbrevs::.
  858.  
  859.    The built-in abbrevs are unusual in one way: they all start with a
  860. semicolon.  You cannot normally use semicolon in an abbrev, but Fortran
  861. mode makes this possible by changing the syntax of semicolon to "word
  862. constituent."
  863.  
  864.    For example, one built-in Fortran abbrev is `;c' for `continue'.  If
  865. you insert `;c' and then insert a punctuation character such as a space
  866. or a newline, the `;c' expands automatically to `continue', provided
  867. Abbrev mode is enabled.
  868.  
  869.    Type `;?' or `;C-h' to display a list of all the built-in Fortran
  870. abbrevs and what they stand for.
  871.  
  872. 
  873. File: emacs,  Node: Asm Mode,  Prev: Fortran,  Up: Programs
  874.  
  875. Asm Mode
  876. ========
  877.  
  878.    Asm mode is a major mode for editing files of assembler code.  It
  879. defines these commands:
  880.  
  881. `TAB'
  882.      `tab-to-tab-stop'.
  883.  
  884. `LFD'
  885.      Insert a newline and then indent using `tab-to-tab-stop'.
  886.  
  887. `:'
  888.      Insert a colon and then remove the indentation from before the
  889.      label preceding colon.  Then do `tab-to-tab-stop'.
  890.  
  891. `;'
  892.      Insert or align a comment.
  893.  
  894.    The variable `asm-comment-char' specifies which character starts
  895. comments in assembler syntax.
  896.  
  897. 
  898. File: emacs,  Node: Building,  Next: Abbrevs,  Prev: Programs,  Up: Top
  899.  
  900. Compiling and Testing Programs
  901. ******************************
  902.  
  903.    The previous chapter discusses the Emacs commands that are useful for
  904. making changes in programs.  This chapter deals with commands that
  905. assist in the larger process of developing and maintaining programs.
  906.  
  907. * Menu:
  908.  
  909. * Compilation::                   Compiling programs in languages other
  910.                                     than Lisp (C, Pascal, etc.)
  911. * Debuggers::                      Running symbolic debuggers for
  912.                                     non-Lisp programs.
  913. * Executing Lisp::                Various modes for editing Lisp programs,
  914.                                     with different facilities for running
  915.                                     the Lisp programs.
  916. * Libraries: Lisp Libraries.      Creating Lisp programs to run in Emacs.
  917. * Interaction: Lisp Interaction.  Executing Lisp in an Emacs buffer.
  918. * Eval: Lisp Eval.                Executing a single Lisp expression in Emacs.
  919. * External Lisp::                 Communicating through Emacs with a
  920.                                     separate Lisp.
  921.  
  922. 
  923. File: emacs,  Node: Compilation,  Next: Debuggers,  Up: Building
  924.  
  925. Running Compilations under Emacs
  926. ================================
  927.  
  928.    Emacs can run compilers for noninteractive languages such as C and
  929. Fortran as inferior processes, feeding the error log into an Emacs
  930. buffer.  It can also parse the error messages and show you the source
  931. lines where compilation errors occurred.
  932.  
  933. `M-x compile'
  934.      Run a compiler asynchronously under Emacs, with error messages to
  935.      `*compilation*' buffer.
  936.  
  937. `M-x grep'
  938.      Run `grep' asynchronously under Emacs, with matching lines listed
  939.      in the buffer named `*grep*'.
  940.  
  941. `M-x kill-compilation'
  942. `M-x kill-grep'
  943.      Kill the running compilation or `grep' subprocess.
  944.  
  945. `C-x `'
  946.      Visit the locus of the next compiler error message or `grep' match.
  947.  
  948. `C-c C-c'
  949.      Visit the locus of the error message that point is on.  This
  950.      command is used in the compilation buffer.
  951.  
  952. `Mouse-2'
  953.      Visit the locus of the error message that you click on.
  954.  
  955.    To run `make' or another compilation command, do `M-x compile'.
  956. This command reads a shell command line using the minibuffer, and then
  957. executes the command in an inferior shell, putting output in the buffer
  958. named `*compilation*'.  The current buffer's default directory is used
  959. as the working directory for the execution of the command; normally,
  960. therefore, the compilation happens in this directory.
  961.  
  962.    When the shell command line is read, the minibuffer appears
  963. containing a default command line, which is the command you used the
  964. last time you did `M-x compile'.  If you type just RET, the same command
  965. line is used again.  For the first `M-x compile', the default is `make
  966. -k'.  The default compilation command comes from the variable
  967. `compile-command'; if the appropriate compilation command for a file is
  968. something other than `make -k', it can be useful for the file to
  969. specify a local value for `compile-command' (*note File Variables::.).
  970.  
  971.    Starting a compilation displays the buffer `*compilation*' in
  972. another window but does not select it.  The buffer's mode line tells you
  973. whether compilation is finished, with the word `run' or `exit' inside
  974. the parentheses.  You do not have to keep this buffer visible;
  975. compilation continues in any case.  While a compilation is going on, the
  976. string `Compiling' appears in the mode lines of all windows.  When this
  977. string disappears, the compilation is finished.
  978.  
  979.    To kill the compilation process, do `M-x kill-compilation'.  When
  980. the compiler process terminates, the mode line of the `*compilation*'
  981. buffer changes to say `signal' instead of `run'.  Starting a new
  982. compilation also kills any running compilation, as only one can exist
  983. at any time.  However, `M-x compile' asks for confirmation before
  984. actually killing a compilation that is running.
  985.  
  986.    The `*compilation*' buffer uses a special major mode, Compilation
  987. mode.  This mode provides the keys SPC and DEL to scroll by screenfuls,
  988. and `M-n' and `M-p' to move to the next or previous error message.  You
  989. can also use `M-{' and `M-}' to move up or down to an error message for
  990. a different source file.
  991.  
  992.    You can visit the source for any particular error message by moving
  993. point in `*compilation*' to that error message and typing `C-c C-c'
  994. (`compile-goto-error').  To parse the compiler error messages
  995. sequentially, type `C-x `' (`next-error').  The character following the
  996. `C-x' is the backquote or "grave accent," not the single-quote.  This
  997. command is available in all buffers, not just in `*compilation*'; it
  998. displays the next error message at the top of one window and source
  999. location of the error in another window.
  1000.  
  1001.    The first time `C-x `' is used after the start of a compilation, it
  1002. moves to the first error's location.  Subsequent uses of `C-x `'
  1003. advance down to subsequent errors.  If you visit a specific error
  1004. message with `C-c C-c' or `Mouse-2', subsequent `C-x `' commands
  1005. advance from there.  When `C-x `' gets to the end of the buffer and
  1006. finds no more error messages to visit, it fails and signals an Emacs
  1007. error.
  1008.  
  1009.    `C-u C-x `' starts scanning from the beginning of the compilation
  1010. buffer.  This way, you can process the same set of errors again.
  1011.  
  1012.    Just as you can run a compiler, you can also run `grep' and then
  1013. visit the lines on which matches were found.  To do this, type `M-x
  1014. grep' with an argument line that contains the same arguments you would
  1015. give `grep' when running it normally: a `grep'-style regexp (usually in
  1016. single-quotes to quote the shell's special characters) followed by file
  1017. names which may use wildcards.  The output from `grep' goes in the
  1018. `*grep*' buffer and the lines that matched can be found with `C-x `' as
  1019. if they were compilation errors.
  1020.  
  1021.    Note: a shell is used to run the compile command, but the shell is
  1022. told that it should be noninteractive.  This means in particular that
  1023. the shell starts up with no prompt.  If you find your usual shell
  1024. prompt making an unsightly appearance in the `*compilation*' buffer, it
  1025. means you have made a mistake in your shell's init file (`.cshrc' or
  1026. `.shrc' or ...) by setting the prompt unconditionally.  The shell init
  1027. file should set the prompt only if there already is a prompt.  In csh,
  1028. here is how to do it:
  1029.  
  1030.      if ($?prompt) set prompt = ...
  1031.  
  1032. And here's how to do it in bash:
  1033.  
  1034.      if [ "${PS1+set}" = set ]
  1035.      then prompt=...
  1036.      fi
  1037.  
  1038.    There may well be other things that your shell's init file ought to
  1039. do only for an interactive shell.  You can use the same method to
  1040. conditionalize them.
  1041.  
  1042.    The features of Compilation mode are also available in a minor mode
  1043. called Compilation Minor mode.  This lets you parse error messages in
  1044. any buffer, not just a normal compilation output buffer.  Type `M-x
  1045. compilation-minor-mode' to enable the minor mode.  This defines the keys
  1046. `C-c C-c' and `Mouse-2', as in the Compilation major mode.  In an
  1047. Rlogin buffer (*note Remote Host::.), Compilation minor mode
  1048. automatically accesses remote source files by FTP (*note File Names::.).
  1049.  
  1050.    The MS-DOS "operating system" does not support asynchronous
  1051. subprocesses; to work around this lack, `M-x compile' runs the
  1052. compilation command synchronously on MS-DOS.  As a consequence, you must
  1053. wait until the command finishes before you can do anything else in
  1054. Emacs.  *Note MS-DOS::.
  1055.  
  1056. 
  1057. File: emacs,  Node: Debuggers,  Next: Executing Lisp,  Prev: Compilation,  Up: Building
  1058.  
  1059. Running Debuggers Under Emacs
  1060. =============================
  1061.  
  1062.    The GUD (Grand Unified Debugger) library provides an interface to
  1063. various symbolic debuggers from within Emacs.  We recommend the debugger
  1064. GDB, which is free software, but you can also run DBX, SDB or XDB if you
  1065. have them.  GUD can also serve as an interface to the Perl's debugging
  1066. mode.
  1067.  
  1068. * Menu:
  1069.  
  1070. * Starting GUD::    How to start a debugger subprocess.
  1071. * Debugger Operation::    Connection between the debugger and source buffers.
  1072. * Commands of GUD::    Key bindings for common commands.
  1073. * GUD Customization::    Defining your own commands for GUD.
  1074.  
  1075. 
  1076. File: emacs,  Node: Starting GUD,  Next: Debugger Operation,  Up: Debuggers
  1077.  
  1078. Starting GUD
  1079. ------------
  1080.  
  1081.    There are five commands for starting a debugger, each corresponding
  1082. to a particular debugger program.
  1083.  
  1084. `M-x gdb RET FILE RET'
  1085.      Run GDB as a subprocess of Emacs.  This command creates a buffer
  1086.      for input and output to GDB, and switches to it.  If a GDB buffer
  1087.      already exists, it just switches to that buffer.
  1088.  
  1089. `M-x dbx RET FILE RET'
  1090.      Similar, but run DBX instead of GDB.
  1091.  
  1092. `M-x xdb RET FILE RET'
  1093.      Similar, but run XDB instead of GDB.  Use the variable
  1094.      `gud-xdb-directories' to specify directories to search for source
  1095.      files.
  1096.  
  1097. `M-x sdb RET FILE RET'
  1098.      Similar, but run SDB instead of GDB.
  1099.  
  1100.      Some versions of SDB do not mention source file names in their
  1101.      messages.  When you use them, you need to have a valid tags table
  1102.      (*note Tags::.) in order for GUD to find functions in the source
  1103.      code.  If you have not visited a tags table or the tags table
  1104.      doesn't list one of the functions, you get a message saying `The
  1105.      sdb support requires a valid tags table to work'.  If this
  1106.      happens, generate a valid tags table in the working directory and
  1107.      try again.
  1108.  
  1109. `M-x perldb RET FILE RET'
  1110.      Run the Perl interpreter in debug mode to debug FILE, a Perl
  1111.      program.
  1112.  
  1113.    You can only run one debugger process at a time.
  1114.  
  1115.    Each of these commands takes one argument: a command line to invoke
  1116. the debugger.  In the simplest case, specify just the name of the
  1117. executable file you want to debug.  You may also use options that the
  1118. debugger supports.  However, shell wild cards and variables are not
  1119. allowed.  GUD assumes that the first argument not preceded by a `-' is
  1120. the executable file name.
  1121.  
  1122. 
  1123. File: emacs,  Node: Debugger Operation,  Next: Commands of GUD,  Prev: Starting GUD,  Up: Debuggers
  1124.  
  1125. Debugger Operation
  1126. ------------------
  1127.  
  1128.    When you run a debugger with GUD, the debugger uses an Emacs buffer
  1129. for its ordinary input and output.  This is called the GUD buffer.  The
  1130. debugger displays the source files of the program by visiting them in
  1131. Emacs buffers.  An arrow (`=>') in one of these buffers indicates the
  1132. current execution line.  Moving point in this buffer does not move the
  1133. arrow.
  1134.  
  1135.    You can start editing these source files at any time in the buffers
  1136. that were made to display them.  The arrow is not part of the file's
  1137. text; it appears only on the screen.  If you do modify a source file,
  1138. keep in mind that inserting or deleting lines will throw off the arrow's
  1139. positioning; GUD has no way of figuring out which line corresponded
  1140. before your changes to the line number in a debugger message.  Also,
  1141. you'll typically have to recompile and restart the program for your
  1142. changes to be reflected in the debugger's tables.
  1143.  
  1144.    If you wish, you can control your debugger process entirely through
  1145. the debugger buffer, which uses a variant of Shell mode.  All the usual
  1146. commands for your debugger are available, and you can use the Shell mode
  1147. history commands to repeat them.  *Note Shell Mode::.
  1148.  
  1149. 
  1150. File: emacs,  Node: Commands of GUD,  Next: GUD Customization,  Prev: Debugger Operation,  Up: Debuggers
  1151.  
  1152. Commands of GUD
  1153. ---------------
  1154.  
  1155.    The GUD interaction buffer uses a variant of Shell mode, so the
  1156. commands of Shell mode are available (*note Shell Mode::.).  GUD mode
  1157. also provides commands for setting and clearing breakpoints, for
  1158. selecting stack frames, and for stepping through the program.  These
  1159. commands are available both in the GUD buffer and globally, but with
  1160. different key bindings.
  1161.  
  1162.    The breakpoint commands are usually used in source file buffers,
  1163. because that is the way to specify where to set or clear the breakpoint.
  1164. Here's the global command to set a breakpoint:
  1165.  
  1166. `C-x SPC'
  1167.      Set a breakpoint on the source line that point is on.
  1168.  
  1169.    Here are the other special commands provided by GUD.  The keys
  1170. starting with `C-c' are available only in the GUD interaction buffer.
  1171. The bindings that start with `C-x C-a' are available in the GUD buffer
  1172. and also in source files.
  1173.  
  1174. `C-c C-l'
  1175. `C-x C-a C-l'
  1176.      Display in another window the last line referred to in the GUD
  1177.      buffer (that is, the line indicated in the last location message).
  1178.      This runs the command `gud-refresh'.
  1179.  
  1180. `C-c C-s'
  1181. `C-x C-a C-s'
  1182.      Execute a single line of code (`gud-step').  If the line contains
  1183.      a function call, execution stops after entering the called
  1184.      function.
  1185.  
  1186. `C-c C-n'
  1187. `C-x C-a C-n'
  1188.      Execute a single line of code, stepping across entire function
  1189.      calls at full speed (`gud-next').
  1190.  
  1191. `C-c C-i'
  1192. `C-x C-a C-i'
  1193.      Execute a single machine instruction (`gud-stepi').
  1194.  
  1195. `C-c C-r'
  1196. `C-x C-a C-r'
  1197.      Continue execution without specifying any stopping point.  The
  1198.      program will run until it hits a breakpoint, terminates, or gets a
  1199.      signal that the debugger is checking for (`gud-cont').
  1200.  
  1201. `C-c C-d'
  1202. `C-x C-a C-d'
  1203.      Delete the breakpoint(s) on the current source line, if any
  1204.      (`gud-remove').  If you use this command in the GUD interaction
  1205.      buffer, it applies to the line where the program last stopped.
  1206.  
  1207. `C-c C-t'
  1208. `C-x C-a C-t'
  1209.      Set a temporary breakpoint on the current source line, if any.  If
  1210.      you use this command in the GUD interaction buffer, it applies to
  1211.      the line where the program last stopped.
  1212.  
  1213.    The above commands are common to all supported debuggers.  If you are
  1214. using GDB or (some versions of) DBX, these additional commands are
  1215. available:
  1216.  
  1217. `C-c <'
  1218. `C-x C-a <'
  1219.      Select the next enclosing stack frame (`gud-up').  This is
  1220.      equivalent to the `up' command.
  1221.  
  1222. `C-c >'
  1223. `C-x C-a >'
  1224.      Select the next inner stack frame (`gud-down').  This is
  1225.      equivalent to the `down' command.
  1226.  
  1227.    If you are using GDB, these additional key bindings are available:
  1228.  
  1229. `TAB'
  1230.      With GDB, complete a symbol name (`gud-gdb-complete-command').
  1231.      This key is available only in the GUD interaction buffer, and
  1232.      requires GDB versions 4.13 and later.
  1233.  
  1234. `C-c C-f'
  1235. `C-x C-a C-f'
  1236.      Run the program until the selected stack frame returns (or until it
  1237.      stops for some other reason).
  1238.  
  1239.    These commands interpret a numeric argument as a repeat count, when
  1240. that makes sense.
  1241.  
  1242.